package com.cczhr.bloglibrary;

import android.util.Log;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect
public class BLogAspect {
    private static final String TAG = "cczhr-----";

    @Before("execution(@com.cczhr.bloglibrary.BLogTool * *(..))&& @annotation(bLogTool)")
    public void loggerDebug(final JoinPoint jp,final BLogTool bLogTool) throws Throwable {
        Object[] args = jp.getArgs();

        switch (bLogTool.value()){
            case INFO:
                Log.e(TAG, "loggerDebug:--------INFO--------- "+args[0]+"---------"+args[1] +bLogTool.value());
                break;
            case DEBUG:
                Log.e(TAG, "loggerDebug:--------DEBUG--------- "+args[0]+"---------"+args[1] +bLogTool.value());
                break;
            case WARN:
                Log.e(TAG, "loggerDebug:--------WARN--------- "+args[0]+"---------"+args[1] +bLogTool.value());
                break;
            case ERROR:
                Log.e(TAG, "loggerDebug:--------ERROR--------- "+args[0]+"---------"+args[1] +bLogTool.value());
                break;
            case VERBOSE:
                Log.e(TAG, "loggerDebug:--------VERBOSE--------- "+args[0]+"---------"+args[1] +bLogTool.value());
                break;
        }


    }


}